import React from "react";
import { useState } from "react";
import _ from 'lodash';
import {random as r} from 'lodash';

export default function BgCom() {
  //声明状态
  let [color, setColor] = useState('hotpink'); //颜色
  //声明事件回调
  let changeBg = () => {
    setColor(`rgb(${r(200, 255)},${r(200, 255)},${r(200, 255)})`);//  rgb(0,0,0)   #124562    orange   hls
  }

  return <div onClick={changeBg} style={{ width: 400, height: 300, background: color }}></div>;
}
